****************************************************************************
* Do File for "Trade Plants the Flag:                                      *
* Sanctions-busting and the Signing of New Preferential Trade Agreements   *
* Foreign Policy Analysis                                                  *
* By Yi-hao Su, 1/30/2020						                           *
* Contact at: ysu2@albany.edu									           *				   
****************************************************************************	

** Version: Stata 15
** Main Document

// To install the package of rare event models, visit https://gking.harvard.edu/scholar_software/relogit-rare-events-logistic-regression/1-1-stata
// Version 1.1.1, October 28, 1999

** Table 1: Rare Event Models on Signing of PTAs
quietly: eststo Model_1: relogit PTA_sign Trade_Sanc Trade_Busters Trade_Senders Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_2: relogit PTA_sign Uni_Sanc Uni_Busters Uni_Senders Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_3: relogit PTA_sign Multi_Sanc Multi_Busters Multi_Senders Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_4: relogit PTA_sign Trade_Sanc Trade_Busters Trade_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_5: relogit PTA_sign Uni_Sanc Uni_Busters Uni_Senders Defense PTA_depth Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_6: relogit PTA_sign Multi_Sanc Multi_Busters Multi_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)

quietly: esttab Model_1 Model_2 Model_3 Model_4 Model_5 Model_6, se(3) pr2 b(3) t(3) star(* 0.05 ** 0.01 *** 0.001)
esttab, rename(Uni_Sanc Trade_Sanc Multi_Sanc Trade_Sanc Uni_Busters Trade_Busters Multi_Busters Trade_Busters Uni_Senders Trade_Senders Multi_Senders Trade_Senders) label ///
										   mtitles("All" "Unilateral" "Multilateral" "All" "Unilateral" "Multilateral") ///
										   t(3) drop(T1 T2 T3) ///
										   order(Trade_Sanc Trade_Busters Trade_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj)	
eststo clear
** Table 2 & C: Substantive Effects of Variables on the Likelihood of PTA Signature									   
* Change in Predicted Probability Using All Trade Sanctions
quietly: relogit PTA_sign Trade_Sanc Trade_Busters Trade_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: setx  (Trade_Senders) 0 (Trade_Sanc Trade_Busters Defense Democracy WTO Colony RTA) 1 (PTA_depth ln_distance ln_GDPi ln_GDPj T1 T2 T3) mean
relogitq, pr listx
relogitq, fd(pr) changex(Trade_Sanc 0 1)
relogitq, fd(pr) changex(Trade_Busters 0 1)
relogitq, fd(pr) changex(Trade_Senders 0 1)
relogitq, fd(pr) changex(PTA_depth 0 1)
relogitq, fd(pr) changex(Defense 0 1)
relogitq, fd(pr) changex(WTO 0 1)
relogitq, fd(pr) changex(RTA 0 1)
relogitq, fd(pr) changex(Colony 0 1)
relogitq, fd(pr) changex(Democracy 0 1)
clear results

* Relative Risks Using All Trade Sanctions
quietly: relogit PTA_sign Trade_Sanc Trade_Busters Trade_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: setx  (Trade_Senders) 0 (Trade_Sanc Trade_Busters Defense Democracy WTO Colony RTA) 1 (PTA_depth ln_distance ln_GDPi ln_GDPj T1 T2 T3) mean
relogitq, rr(Trade_Sanc 0 1)
relogitq, rr(Trade_Busters 0 1)
relogitq, rr(Trade_Senders 0 1)
relogitq, rr(PTA_depth 0 1)
relogitq, rr(Defense 0 1)
relogitq, rr(WTO 0 1)
relogitq, rr(RTA 0 1)
relogitq, rr(Colony 0 1)
relogitq, rr(Democracy 0 1)
clear results
				
* Change in Predicted Probability Using Unilateral Trade Sanctions
quietly: relogit PTA_sign Uni_Sanc Uni_Busters Uni_Senders T1 T2 T3 PTA_depth Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: setx  (Uni_Senders) 0 (Uni_Sanc Uni_Busters Defense Democracy WTO Colony RTA) 1 (PTA_depth ln_distance ln_GDPi ln_GDPj T1 T2 T3) mean
relogitq, pr listx
relogitq, fd(pr) changex(Uni_Sanc 0 1)
relogitq, fd(pr) changex(Uni_Busters 0 1)
relogitq, fd(pr) changex(Uni_Senders 0 1)
relogitq, fd(pr) changex(PTA_depth 0 1)
relogitq, fd(pr) changex(Defense 0 1)
relogitq, fd(pr) changex(WTO 0 1)
relogitq, fd(pr) changex(RTA 0 1)
relogitq, fd(pr) changex(Colony 0 1)
relogitq, fd(pr) changex(Democracy 0 1)
clear results

* Relative Risks Using Unilateral Trade Sanctions
quietly: relogit PTA_sign Uni_Sanc Uni_Busters Uni_Senders T1 T2 T3 PTA_depth Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: setx  (Uni_Senders) 0 (Uni_Sanc Uni_Busters Defense Democracy WTO Colony RTA) 1 (PTA_depth ln_distance ln_GDPi ln_GDPj T1 T2 T3) mean
relogitq, rr(Uni_Sanc 0 1)
relogitq, rr(Uni_Busters 0 1)
relogitq, rr(Uni_Senders 0 1)
relogitq, rr(PTA_depth 0 1)
relogitq, rr(Defense 0 1)
relogitq, rr(WTO 0 1)
relogitq, rr(RTA 0 1)
relogitq, rr(Colony 0 1)
relogitq, rr(Democracy 0 1)
clear results
				
* Change in Predicted Probability Using Multilateral Sanctions
quietly: relogit PTA_sign Multi_Sanc Multi_Busters Multi_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: setx  (Multi_Senders) 0 (Multi_Sanc Multi_Busters Defense Democracy WTO Colony RTA) 1 (PTA_depth ln_distance ln_GDPi ln_GDPj T1 T2 T3) mean
relogitq, pr listx
relogitq, fd(pr) changex(Multi_Sanc 0 1)
relogitq, fd(pr) changex(Multi_Busters 0 1)
relogitq, fd(pr) changex(Multi_Senders 0 1)
relogitq, fd(pr) changex(PTA_depth 0 1)
relogitq, fd(pr) changex(Defense 0 1)
relogitq, fd(pr) changex(WTO 0 1)
relogitq, fd(pr) changex(RTA 0 1)
relogitq, fd(pr) changex(Colony 0 1)
relogitq, fd(pr) changex(Democracy 0 1)
clear results

* Relative Risks Using Multilateral Sanctions
quietly: relogit PTA_sign Multi_Sanc Multi_Busters Multi_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: setx  (Multi_Senders) 0 (Multi_Sanc Multi_Busters Defense Democracy WTO Colony RTA) 1 (PTA_depth ln_distance ln_GDPi ln_GDPj T1 T2 T3) mean
relogitq, rr(Multi_Sanc 0 1)
relogitq, rr(Multi_Busters 0 1)
relogitq, rr(Multi_Senders 0 1)
relogitq, rr(PTA_depth 0 1)
relogitq, rr(Defense 0 1)
relogitq, rr(WTO 0 1)
relogitq, rr(RTA 0 1)
relogitq, rr(Colony 0 1)
relogitq, rr(Democracy 0 1)
clear results				

// To access the code of inverse probability weighting (IPW), visit https://www.hsph.harvard.edu/miguel-hernan/causal-inference-book/
// Version and Date: January 8, 2019
// Program 12.5: Estimating the parameters of a marginal structural logistic model

** Table 3: Causal Effects of Sanctions-busting on Signing of PTAs using IPW
* Without Cost to Target
* On Trade Busters Without PTA Depth

// Fit a logistic model for the denominator of the IP weights and predict the conditional probability of trade-based sanctions-busting
quietly: logit Trade_Busters Trade_Senders Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd1, pr

// Fit a logistic model for the numerator of IP weights and predict Pr(A=1), note the missing data of GDP
quietly: logit Trade_Busters if ln_GDPi !=. & ln_GDPj !=.
quietly: predict psn1, pr

// Generate stabilized weights as f(A)/f(A|L)
quietly: gen sw1=.
quietly: replace sw1=psn1/psd1 if Trade_Busters==1
quietly: replace sw1=(1-psn1)/(1-psd1) if Trade_Busters==0

// Fit a logistic model in the pseudopopulation
logit PTA_sign Trade_Busters [pweight=sw1], cluster(PairID) // Model 1										   

// The rest IPW codes follow the same steps as above
									   
* On Unilateral Busters Without PTA Depth 
quietly: logit Uni_Busters Uni_Senders Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd2, pr
quietly: logit Uni_Busters if ln_GDPi !=. & ln_GDPj !=.
quietly: predict psn2, pr
quietly: gen sw2=.
quietly: replace sw2=psn2/psd2 if Uni_Busters==1
quietly: replace sw2=(1-psn2)/(1-psd2) if Uni_Busters==0
logit PTA_sign Uni_Busters [pweight=sw2], cluster(PairID) // Model 2										   

* On Multilateral Busters Without PTA Depth 
quietly: logit Multi_Busters Multi_Senders Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd3, pr
quietly: logit Multi_Busters if ln_GDPi !=. & ln_GDPj !=.
quietly: predict psn3, pr
quietly: gen sw3=.
quietly: replace sw3=psn3/psd3 if Multi_Busters==1
quietly: replace sw3=(1-psn3)/(1-psd3) if Multi_Busters==0
logit PTA_sign Multi_Busters [pweight=sw3], cluster(PairID) // Model 3										   

* On Trade Busters With PTA Depth 
quietly: logit Trade_Busters Trade_Senders PTA_depth Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd4, pr
quietly: logit Trade_Busters if ln_GDPi !=. & ln_GDPj !=. & PTA_depth !=.
quietly: predict psn4, pr
quietly: gen sw4=.
quietly: replace sw4=psn4/psd4 if Trade_Busters==1
quietly: replace sw4=(1-psn4)/(1-psd4) if Trade_Busters==0
logit PTA_sign Trade_Busters [pweight=sw4], cluster(PairID) // Model 4										   

* On Unilateral Busters With PTA Depth 
quietly: logit Uni_Busters Uni_Senders PTA_depth Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd5, pr
quietly: logit Uni_Busters if ln_GDPi !=. & ln_GDPj !=. & PTA_depth !=.
quietly: predict psn5, pr
quietly: gen sw5=.
quietly: replace sw5=psn5/psd5 if Uni_Busters==1
quietly: replace sw5=(1-psn5)/(1-psd5) if Uni_Busters==0
logit PTA_sign Uni_Busters [pweight=sw5], cluster(PairID) // Model 5										   

** On Multilateral Busters With PTA Depth 
quietly: logit Multi_Busters Multi_Senders PTA_depth Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd6, pr
quietly: logit Multi_Busters if ln_GDPi !=. & ln_GDPj !=. & PTA_depth !=.
quietly: predict psn6, pr
quietly: gen sw6=.
quietly: replace sw6=psn6/psd6 if Multi_Busters==1
quietly: replace sw6=(1-psn6)/(1-psd6) if Multi_Busters==0
logit PTA_sign Multi_Busters [pweight=sw6], cluster(PairID) // Model 6										   

** Online Appendix

* Table B: Summary Statistics
estpost sum PTA_sign PTA_market Trade_Sanc Uni_Sanc Multi_Sanc Trade_Busters Uni_Busters Multi_Busters Trade_Senders Uni_Senders Multi_Senders Cost_Tar Cost_UTar Cost_MTar PTA_depth Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj
esttab . using Table1.rtf, cell((count(fmt(%12.0fc)) mean(fmt(%12.3fc)) sd(fmt(%12.3fc)) min(fmt(%9.3g)) max(fmt(%9.3g)))) nonumber nomtitle long varwidth(20) modelwidth(8) label replace onecell eqlabels(none) 

* Table D: Rare Event Models on Signing of PTAs Using Lagged Sanctions-busting					   
quietly: eststo Model_7:  relogit PTA_sign Trade_Sanc l_TBusters Trade_Senders T1 T2 T3 Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: eststo Model_8:  relogit PTA_sign Uni_Sanc l_UBusters Uni_Senders T1 T2 T3 Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: eststo Model_9:  relogit PTA_sign Multi_Sanc l_MBusters Multi_Senders T1 T2 T3 Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: eststo Model_10: relogit PTA_sign Trade_Sanc l_TBusters Trade_Senders T1 T2 T3 PTA_depth Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: eststo Model_11: relogit PTA_sign Uni_Sanc l_UBusters Uni_Senders T1 T2 T3 PTA_depth Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: eststo Model_12: relogit PTA_sign Multi_Sanc l_MBusters Multi_Senders T1 T2 T3 PTA_depth Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)

quietly: esttab Model_7 Model_8 Model_9 Model_10 Model_11 Model_12, se(3) pr2 b(3) t(3) star(* 0.05 ** 0.01 *** 0.001)
esttab, rename(Uni_Sanc Trade_Sanc Multi_Sanc Trade_Sanc l_UBusters l_TBusters l_MBusters l_TBusters Uni_Senders Trade_Senders Multi_Senders Trade_Senders) label ///
										   nonumbers mtitles("(7) All" "(8) Unilateral" "(9) Multilateral" "(10) All" "(11) Unilateral" "(12) Multilateral") ///
										   t(3) drop(T1 T2 T3) ///
										   order(Trade_Sanc l_TBusters Trade_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj)	
eststo clear			
* Table E: Rare Event Models on Signing of PTAs with Market Access										   
quietly: eststo Model_13: relogit PTA_market Trade_Sanc Trade_Busters Trade_Senders Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_14: relogit PTA_market Uni_Sanc Uni_Busters Uni_Senders Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_15: relogit PTA_market Multi_Sanc Multi_Busters Multi_Senders Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_16: relogit PTA_market Trade_Sanc Trade_Busters Trade_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_17: relogit PTA_market Uni_Sanc Uni_Busters Uni_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_18: relogit PTA_market Multi_Sanc Multi_Busters Multi_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)

quietly: esttab Model_13 Model_14 Model_15 Model_16 Model_17 Model_18, se(3) pr2 b(3) t(3) star(* 0.05 ** 0.01 *** 0.001)
esttab, rename(Uni_Sanc Trade_Sanc Multi_Sanc Trade_Sanc Uni_Busters Trade_Busters Multi_Busters Trade_Busters Uni_Senders Trade_Senders Multi_Senders Trade_Senders) label ///
										   nonumbers mtitles("(13) All" "(14) Unilateral" "(15) Multilateral" "(16) All" "(17) Unilateral" "(18) Multilateral") ///
										   t(3) drop(t1 t2 t3) ///
										   order(Trade_Sanc Trade_Busters Trade_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj)									   
eststo clear							  
* Table F: Rare Event Models on Signing of PTAs with Market Access Using Lagged Sanctions-busting
quietly: eststo Model_19: relogit PTA_market Trade_Sanc l_TBusters Trade_Senders Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_20: relogit PTA_market Uni_Sanc l_UBusters Uni_Senders Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_21: relogit PTA_market Multi_Sanc l_MBusters Multi_Senders Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_22: relogit PTA_market Trade_Sanc l_TBusters Trade_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_23: relogit PTA_market Uni_Sanc l_UBusters Uni_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_24: relogit PTA_market Multi_Sanc l_MBusters Multi_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)

quietly: esttab Model_19 Model_20 Model_21 Model_22 Model_23 Model_24, se(3) pr2 b(3) t(3) star(* 0.05 ** 0.01 *** 0.001)
esttab, rename(Uni_Sanc Trade_Sanc Multi_Sanc Trade_Sanc l_UBusters l_TBusters l_MBusters l_TBusters Uni_Senders Trade_Senders Multi_Senders Trade_Senders) label ///
										   nonumbers mtitles("(19) All" "(20) Unilateral" "(21) Multilateral" "(22) All" "(23) Unilateral" "(24) Multilateral") ///
										   t(3) drop(t1 t2 t3) ///
										   order(Trade_Sanc l_TBusters Trade_Senders PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj)									   
eststo clear
* Table G: Rare Event Models on Signing of PTAs Controlling for Cost to Targets
quietly: eststo Model_25: relogit PTA_sign Trade_Sanc Trade_Busters Trade_Senders Cost_Tar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_26: relogit PTA_sign Uni_Sanc Uni_Busters Uni_Senders Cost_UTar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_27: relogit PTA_sign Multi_Sanc Multi_Busters Multi_Senders Cost_MTar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_28: relogit PTA_sign Trade_Sanc Trade_Busters Trade_Senders PTA_depth Cost_Tar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_29: relogit PTA_sign Uni_Sanc Uni_Busters Uni_Senders PTA_depth Cost_UTar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_30: relogit PTA_sign Multi_Sanc Multi_Busters Multi_Senders PTA_depth Cost_MTar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)

quietly: esttab Model_25 Model_26 Model_27 Model_28 Model_29 Model_30, se(3) pr2 b(3) t(3) star(* 0.05 ** 0.01 *** 0.001)
esttab, rename(Uni_Sanc Trade_Sanc Multi_Sanc Trade_Sanc Uni_Busters Trade_Busters Multi_Busters Trade_Busters Uni_Senders Trade_Senders Multi_Senders Trade_Senders Cost_UTar Cost_Tar Cost_MTar Cost_Tar) label ///
										   nonumbers mtitles("(25) All" "(26) Unilateral" "(27) Multilateral" "(28) All" "(29) Unilateral" "(30) Multilateral") ///
										   t(3) drop(T1 T2 T3) ///
										   order(Trade_Sanc Trade_Busters Trade_Senders Cost_Tar PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj)									   
eststo clear
* Table H: Rare Event Models on Signing of PTAs Using Lagged Sanctions-busting and Controlling for Cost to Targets
quietly: eststo Model_31: relogit PTA_sign Trade_Sanc l_TBusters Trade_Senders Cost_Tar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_32: relogit PTA_sign Uni_Sanc l_UBusters Uni_Senders Cost_UTar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_33: relogit PTA_sign Multi_Sanc l_MBusters Multi_Senders Cost_MTar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_34: relogit PTA_sign Trade_Sanc l_TBusters Trade_Senders PTA_depth Cost_Tar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_35: relogit PTA_sign Uni_Sanc l_UBusters Uni_Senders PTA_depth Cost_UTar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)
quietly: eststo Model_36: relogit PTA_sign Multi_Sanc l_MBusters Multi_Senders PTA_depth Cost_MTar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj T1 T2 T3, cluster(PairID)

quietly: esttab Model_31 Model_32 Model_33 Model_34 Model_35 Model_36, se(3) pr2 b(3) t(3) star(* 0.05 ** 0.01 *** 0.001)
esttab, rename(Uni_Sanc Trade_Sanc Multi_Sanc Trade_Sanc l_UBusters l_TBusters l_MBusters l_TBusters Uni_Senders Trade_Senders Multi_Senders Trade_Senders Cost_UTar Cost_Tar Cost_MTar Cost_Tar) label ///
										   nonumbers mtitles("(31) All" "(32) Unilateral" "(33) Multilateral" "(34) All" "(35) Unilateral" "(36) Multilateral") ///
										   t(3) drop(T1 T2 T3) ///
										   order(Trade_Sanc l_TBusters Trade_Senders Cost_Tar PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj)									   
eststo clear
* Table I: Rare Event Models on Signing of PTAs with Market Access Controlling for Cost to Targets										   
quietly: eststo Model_37: relogit PTA_market Trade_Sanc Trade_Busters Trade_Senders Cost_Tar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_38: relogit PTA_market Uni_Sanc Uni_Busters Uni_Senders Cost_UTar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_39: relogit PTA_market Multi_Sanc Multi_Busters Multi_Senders Cost_MTar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_40: relogit PTA_market Trade_Sanc Trade_Busters Trade_Senders PTA_depth Cost_Tar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_41: relogit PTA_market Uni_Sanc Uni_Busters Uni_Senders PTA_depth Cost_UTar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_42: relogit PTA_market Multi_Sanc Multi_Busters Multi_Senders PTA_depth Cost_MTar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)

quietly: esttab Model_37 Model_38 Model_39 Model_40 Model_41 Model_42, se(3) pr2 b(3) t(3) star(* 0.05 ** 0.01 *** 0.001)
esttab, rename(Uni_Sanc Trade_Sanc Multi_Sanc Trade_Sanc Uni_Busters Trade_Busters Multi_Busters Trade_Busters Uni_Senders Trade_Senders Multi_Senders Trade_Senders Cost_UTar Cost_Tar Cost_MTar Cost_Tar) label ///
										   nonumbers mtitles("(37) All" "(38) Unilateral" "(39) Multilateral" "(40) All" "(41) Unilateral" "(42) Multilateral") ///
										   t(3) drop(t1 t2 t3) ///
										   order(Trade_Sanc Trade_Busters Trade_Senders Cost_Tar PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj)
eststo clear						  								   
* Table J: Rare Event Models on Signing of PTAs with Market Access Using Lagged Sanctions-busting and Controlling for Cost to Targets						   
quietly: eststo Model_43: relogit PTA_market Trade_Sanc l_TBusters Trade_Senders Cost_Tar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_44: relogit PTA_market Uni_Sanc l_UBusters Uni_Senders Cost_UTar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_45: relogit PTA_market Multi_Sanc l_MBusters Multi_Senders Cost_MTar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_46: relogit PTA_market Trade_Sanc l_TBusters Trade_Senders PTA_depth Cost_Tar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_47: relogit PTA_market Uni_Sanc l_UBusters Uni_Senders PTA_depth Cost_UTar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)
quietly: eststo Model_48: relogit PTA_market Multi_Sanc l_MBusters Multi_Senders PTA_depth Cost_MTar Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj t1 t2 t3, cluster(PairID)

quietly: esttab Model_43 Model_44 Model_45 Model_46 Model_47 Model_48, se(3) pr2 b(3) t(3) star(* 0.05 ** 0.01 *** 0.001)
esttab, rename(Uni_Sanc Trade_Sanc Multi_Sanc Trade_Sanc l_UBusters l_TBusters l_MBusters l_TBusters Uni_Senders Trade_Senders Multi_Senders Trade_Senders Cost_UTar Cost_Tar Cost_MTar Cost_Tar) label ///
										   nonumbers mtitles("(43) All" "(44) Unilateral" "(45) Multilateral" "(46) All" "(47) Unilateral" "(48) Multilateral") ///
										   t(3) drop(t1 t2 t3) ///
										   order(Trade_Sanc l_TBusters Trade_Senders Cost_Tar PTA_depth Defense Democracy WTO Colony RTA ln_distance ln_GDPi ln_GDPj)
eststo clear						  								   							  										   
*** IPW after All Models
* Table K: Causal Effects of Sanctions-busting on Signing of PTAs Using Inverse Probability Weighting
* On Lag Trade Busters Without PTA Depth 
quietly: logit l_TBusters Trade_Senders Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd7, pr
quietly: logit l_TBusters if ln_GDPi !=. & ln_GDPj !=.
quietly: predict psn7, pr
quietly: gen sw7=.
quietly: replace sw7=psn7/psd7 if l_TBusters==1
quietly: replace sw7=(1-psn7)/(1-psd7) if l_TBusters==0
logit PTA_sign l_TBusters [pweight=sw7], cluster(PairID) // Model 7										   
logit PTA_market l_TBusters [pweight=sw7], cluster(PairID) // Model 19

* On Lag Unilateral Busters Without PTA Depth 
quietly: logit l_UBusters Uni_Senders Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd8, pr
quietly: logit l_UBusters if ln_GDPi !=. & ln_GDPj !=.
quietly: predict psn8, pr
quietly: gen sw8=.
quietly: replace sw8=psn8/psd8 if l_UBusters==1
quietly: replace sw8=(1-psn8)/(1-psd8) if l_UBusters==0
logit PTA_sign l_UBusters [pweight=sw8], cluster(PairID) // Model 8										   
logit PTA_market l_UBusters [pweight=sw8], cluster(PairID) // Model 20

* On Lag Multilateral Busters Without PTA Depth 
quietly: logit l_MBusters Multi_Senders Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd9, pr
quietly: logit l_MBusters if ln_GDPi !=. & ln_GDPj !=.
quietly: predict psn9, pr
quietly: gen sw9=.
quietly: replace sw9=psn9/psd9 if l_MBusters==1
quietly: replace sw9=(1-psn9)/(1-psd9) if l_MBusters==0
logit PTA_sign l_MBusters [pweight=sw9], cluster(PairID) // Model 9										   
logit PTA_market l_MBusters [pweight=sw9], cluster(PairID) // Model 21

* On Trade Busters With PTA Depth 
quietly: logit l_TBusters Trade_Senders PTA_depth Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd10, pr
quietly: logit l_TBusters if ln_GDPi !=. & ln_GDPj !=. & PTA_depth !=.
quietly: predict psn10, pr
quietly: gen sw10=.
quietly: replace sw10=psn10/psd10 if l_TBusters==1
quietly: replace sw10=(1-psn10)/(1-psd10) if l_TBusters==0
logit PTA_sign l_TBusters [pweight=sw10], cluster(PairID) // Model 10										   
logit PTA_market l_TBusters [pweight=sw10], cluster(PairID) // Model 22

* On Unilateral Busters With PTA Depth 
quietly: logit l_UBusters Uni_Senders PTA_depth Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd11, pr
quietly: logit l_UBusters if ln_GDPi !=. & ln_GDPj !=. & PTA_depth !=.
quietly: predict psn11, pr
quietly: gen sw11=.
quietly: replace sw11=psn11/psd11 if l_UBusters==1
quietly: replace sw11=(1-psn11)/(1-psd11) if l_UBusters==0
logit PTA_sign l_UBusters [pweight=sw11], cluster(PairID) // Model 11										   
logit PTA_market l_UBusters [pweight=sw11], cluster(PairID) // Model 23

* On Multilateral Busters With PTA Depth 
quietly: logit l_MBusters Multi_Senders PTA_depth Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd12, pr
quietly: logit l_MBusters if ln_GDPi !=. & ln_GDPj !=. & PTA_depth !=.
quietly: predict psn12, pr
quietly: gen sw12=.
quietly: replace sw12=psn12/psd12 if l_MBusters==1
quietly: replace sw12=(1-psn12)/(1-psd12) if l_MBusters==0
logit PTA_sign l_MBusters [pweight=sw12], cluster(PairID) // Model 12										   
logit PTA_market l_MBusters [pweight=sw12], cluster(PairID) // Model 24

* On All Busters Without PTA Depth
logit PTA_market Trade_Busters [pweight=sw1], cluster(PairID) // Model 13
logit PTA_market Uni_Busters [pweight=sw2], cluster(PairID) // Model 14
logit PTA_market Multi_Busters [pweight=sw3], cluster(PairID) // Model 15
logit PTA_market Trade_Busters [pweight=sw4], cluster(PairID) // Model 16
logit PTA_market Uni_Busters [pweight=sw5], cluster(PairID) // Model 17
logit PTA_market Multi_Busters [pweight=sw6], cluster(PairID) // Model 18

** Table L: Causal Effects of Sanctions-busting on Signing of PTAs Controlling for Cost to Targets and Using Inverse Probability Weighting
* On Trade Busters Without PTA Depth 
quietly: logit Trade_Busters Trade_Senders Cost_Tar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd13, pr
quietly: logit Trade_Busters if ln_GDPi !=. & ln_GDPj !=.
quietly: predict psn13, pr
quietly: gen sw13=.
quietly: replace sw13=psn13/psd13 if Trade_Busters==1
quietly: replace sw13=(1-psn13)/(1-psd13) if Trade_Busters==0
logit PTA_sign Trade_Busters [pweight=sw13], cluster(PairID) // Model 25										   
logit PTA_market Trade_Busters [pweight=sw13], cluster(PairID) // Model 37

* On Unilateral Busters Without PTA Depth 
quietly: logit Uni_Busters Uni_Senders Cost_UTar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd14, pr
quietly: logit Uni_Busters if ln_GDPi !=. & ln_GDPj !=.
quietly: predict psn14, pr
quietly: gen sw14=.
quietly: replace sw14=psn14/psd14 if Uni_Busters==1
quietly: replace sw14=(1-psn14)/(1-psd14) if Uni_Busters==0
logit PTA_sign Uni_Busters [pweight=sw14], cluster(PairID) // Model 26										   
logit PTA_market Uni_Busters [pweight=sw14], cluster(PairID) // Model 38

* On Multilateral Busters Without PTA Depth 
quietly: logit Multi_Busters Multi_Senders Cost_MTar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd15, pr
quietly: logit Multi_Busters if ln_GDPi !=. & ln_GDPj !=.
quietly: predict psn15, pr
quietly: gen sw15=.
quietly: replace sw15=psn15/psd15 if Multi_Busters==1
quietly: replace sw15=(1-psn15)/(1-psd15) if Multi_Busters==0
logit PTA_sign Multi_Busters [pweight=sw15], cluster(PairID) // Model 27										   
logit PTA_market Multi_Busters [pweight=sw15], cluster(PairID) // Model  39

* On Trade Busters With PTA Depth 
quietly: logit Trade_Busters Trade_Senders PTA_depth Cost_Tar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd16, pr
quietly: logit Trade_Busters if ln_GDPi !=. & ln_GDPj !=. & PTA_depth !=.
quietly: predict psn16, pr
quietly: gen sw16=.
quietly: replace sw16=psn16/psd16 if Trade_Busters==1
quietly: replace sw16=(1-psn16)/(1-psd16) if Trade_Busters==0
logit PTA_sign Trade_Busters [pweight=sw16], cluster(PairID) // Model 28										   
logit PTA_market Trade_Busters [pweight=sw16], cluster(PairID) // Model 40

* On Unilateral Busters With PTA Depth 
quietly: logit Uni_Busters Uni_Senders PTA_depth Cost_UTar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd17, pr
quietly: logit Uni_Busters if ln_GDPi !=. & ln_GDPj !=. & PTA_depth !=.
quietly: predict psn17, pr
quietly: gen sw17=.
quietly: replace sw17=psn17/psd17 if Uni_Busters==1
quietly: replace sw17=(1-psn17)/(1-psd17) if Uni_Busters==0
logit PTA_sign Uni_Busters [pweight=sw17], cluster(PairID) // Model 29										   
logit PTA_market Uni_Busters [pweight=sw17], cluster(PairID) // Model 41

* On Multilateral Busters With PTA Depth 
quietly: logit Multi_Busters Multi_Senders PTA_depth Cost_MTar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd18, pr
quietly: logit Multi_Busters if ln_GDPi !=. & ln_GDPj !=. & PTA_depth !=.
quietly: predict psn18, pr
quietly: gen sw18=.
quietly: replace sw18=psn18/psd18 if Multi_Busters==1
quietly: replace sw18=(1-psn18)/(1-psd18) if Multi_Busters==0
logit PTA_sign Multi_Busters [pweight=sw18], cluster(PairID) // Model 30										   
logit PTA_market Multi_Busters [pweight=sw18], cluster(PairID) // Model 42

* On Lag Trade Busters Without PTA Depth 
quietly: logit l_TBusters Trade_Senders Cost_Tar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd19, pr
quietly: logit l_TBusters if ln_GDPi !=. & ln_GDPj !=. 
quietly: predict psn19, pr
quietly: gen sw19=.
quietly: replace sw19=psn19/psd19 if l_TBusters==1
quietly: replace sw19=(1-psn19)/(1-psd19) if l_TBusters==0
logit PTA_sign l_TBusters [pweight=sw19], cluster(PairID) // Model 31										   
logit PTA_market l_TBusters [pweight=sw19], cluster(PairID) // Model 43

* On Lag Unilateral Busters Without PTA Depth 
quietly: logit l_UBusters Uni_Senders Cost_UTar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd20, pr
quietly: logit l_UBusters if ln_GDPi !=. & ln_GDPj !=.
quietly: predict psn20, pr
quietly: gen sw20=.
quietly: replace sw20=psn20/psd20 if l_UBusters==1
quietly: replace sw20=(1-psn20)/(1-psd20) if l_UBusters==0
logit PTA_sign l_UBusters [pweight=sw20], cluster(PairID) // Model 32										   
logit PTA_market l_UBusters [pweight=sw20], cluster(PairID) // Model 44

* On Lag Multilateral Busters Without PTA Depth 
quietly: logit l_MBusters Multi_Senders Cost_MTar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd21, pr
quietly: logit l_MBusters if ln_GDPi !=. & ln_GDPj !=.
quietly: predict psn21, pr
quietly: gen sw21=.
quietly: replace sw21=psn21/psd21 if l_MBusters==1
quietly: replace sw21=(1-psn21)/(1-psd21) if l_MBusters==0
logit PTA_sign l_MBusters [pweight=sw21], cluster(PairID) // Model 33										   
logit PTA_market l_MBusters [pweight=sw21], cluster(PairID) // Model 45

* On Trade Busters With PTA Depth 
quietly: logit l_TBusters Trade_Senders PTA_depth Cost_Tar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd22, pr
quietly: logit l_TBusters if ln_GDPi !=. & ln_GDPj !=. & PTA_depth !=.
quietly: predict psn22, pr
quietly: gen sw22=.
quietly: replace sw22=psn22/psd22 if l_TBusters==1
quietly: replace sw22=(1-psn22)/(1-psd22) if l_TBusters==0
logit PTA_sign l_TBusters [pweight=sw22], cluster(PairID) // Model 34										   
logit PTA_market l_TBusters [pweight=sw22], cluster(PairID) // Model 46

* On Unilateral Busters With PTA Depth 
quietly: logit l_UBusters Uni_Senders PTA_depth Cost_UTar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd23, pr
quietly: logit l_UBusters if ln_GDPi !=. & ln_GDPj !=. & PTA_depth !=.
quietly: predict psn23, pr
quietly: gen sw23=.
quietly: replace sw23=psn23/psd23 if l_UBusters==1
quietly: replace sw23=(1-psn23)/(1-psd23) if l_UBusters==0
logit PTA_sign l_UBusters [pweight=sw23], cluster(PairID) // Model 35										   
logit PTA_market l_UBusters [pweight=sw23], cluster(PairID) // Model 47

* On Multilateral Busters With PTA Depth 
quietly: logit l_MBusters Multi_Senders PTA_depth Cost_MTar Colony RTA Defense Democracy WTO ln_distance ln_GDPi ln_GDPj, cluster(PairID)
quietly: predict psd24, pr
quietly: logit l_MBusters if ln_GDPi !=. & ln_GDPj !=. & PTA_depth !=.
quietly: predict psn24, pr
quietly: gen sw24=.
quietly: replace sw24=psn24/psd24 if l_MBusters==1
quietly: replace sw24=(1-psn24)/(1-psd24) if l_MBusters==0
logit PTA_sign l_MBusters [pweight=sw24], cluster(PairID) // Model 36										   
logit PTA_market l_MBusters [pweight=sw24], cluster(PairID) // Model 48
										   